Skip to content

fix(finish): offer Close task when the branch holds no work - #368

Open
gnutix wants to merge 3 commits into
johannesjo:mainfrom
gnutix:fix/finish-close-empty-branch
Open

gnutix wants to merge 3 commits into
johannesjo:mainfrom
gnutix:fix/finish-close-empty-branch

Conversation

@gnutix

@gnutix gnutix commented Nov 13, 2026 •

Copy link
Copy Markdown

Problem

A task whose work went out on another branch has an empty branch of its own: no commits since the base, nothing uncommitted. Finish then offers no way to close it:

  • a merged PR on that other branch is ignored on purpose, since it says nothing about this task's own commits, so the "Merged on GitHub → Close task" route never applies;
  • the local flow offers Close task only when already_landed is set, which needs at least one commit whose patch is on the base. An empty branch has none.

So the footer stays on a disabled "Merge into local main" with "No commits on this branch yet", and Push is still on offer. The only way out is the × in the task's title bar.

Fix

createMergeState gains nothingToMerge(): the worktree is on the task's branch, with no committed and no uncommitted changes. Merge commits count as committed changes, so a branch carrying only a merge is not treated as empty. In local mode the Finish dialog treats this like an already-landed branch:

  • the footer says Close task, which opens the normal close dialog;
  • Push, Create PR, the merge options and the base checkout's uncommitted-changes warning are hidden;
  • a quiet notice says why: "Nothing on this branch: it has no commits and no uncommitted changes, so nothing is left to merge." It replaces the warning-tinted "Nothing to merge" banner, which said the same thing with an urgency the state no longer has.

A branch with only uncommitted changes keeps that banner and "Commit the changes to merge them.", and a worktree on another branch still blocks.

Screenshots

Finish on a freshly created task, which has an empty branch. Captured from the built app with the scripts/showcase harness.

Before After
Before: the merge button is disabled with "No commits on this branch yet", and the only other action is Cancel After: a quiet notice says nothing is left to merge, and the footer offers Close task

Tests

FinishDialog.client.test.tsx: the empty branch offers Close task without merging, and hides Push, the PR section, the "Nothing to merge" warning and the base checkout warning. The same state on another branch is not offered. The old "No commits on this branch yet" footer test is gone, since that state now closes. npm run check and npm test pass.

🤖 Generated with Claude Code (Opus 5.5)

gnutix and others added 3 commits November 13, 2026 15:13
When a task's work went out on another branch (a PR on that branch
merged, say), the task's own branch has no commits and Finish had no way
out: the merged PR is ignored because it is not this branch's, and the
local flow only offered Close task once commits had landed. Merge stayed
disabled on "No commits on this branch yet", and Push stayed on offer.

A branch with no commits since the base and no uncommitted changes, on
the task's branch, now counts as having nothing left to merge: the
footer says Close task, Push and Create PR are hidden, and a quiet
notice says why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The empty branch's quiet notice already says nothing is left to merge,
and Close task is the way out, so the warning-tinted "Nothing to merge"
banner beside it repeated the notice with urgency it no longer has. It
still shows when changes are only uncommitted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant